//
// Created by mio on 25-5-13.
//

#ifndef VIDEOCONVERT_H
#define VIDEOCONVERT_H

#include "av_common.h"

struct SwsContext;

class VideoConvert
{
public:
    VideoConvert();
    virtual ~VideoConvert();
    VideoConvert(const VideoConvert&) = delete;
    VideoConvert& operator=(const VideoConvert&) = delete;
public:
    bool Open(qint32 in_width,qint32 in_height,AVPixelFormat in_format,
              qint32 out_width,qint32 out_height,AVPixelFormat out_format);
    void Close();

    qint32 Convert(AVFramePtr in_frame,AVFramePtr& out_frame);
private:
    qint32 width_;
    qint32 height_;
    AVPixelFormat format_;
    SwsContext* swsContext_;
};


#endif //VIDEOCONVERT_H